<template>
  <div class="todoapp">
    <TodoHeader :arr="list" @rendertask= "renderfn"></TodoHeader>
    <TodoMain :arr="list" @rendertask= "renderfn"></TodoMain>
    <TodoFooter  :arr="list" ></TodoFooter>
  </div>
</template>

<script>
import './styles/base.css'
import './styles/index.css'
import axios from 'axios'
import TodoHeader from './components/TodoHeader'
import TodoMain from './components/TodoMain'
import TodoFooter from './components/TodoFooter'
axios.defaults.baseURL = 'http://liufusong.top:3001'
export default {
  data () {
    return {
      list: []
    }
  },
  components: {
    TodoHeader,
    TodoMain,
    TodoFooter
  },
  created () {
    this.getList()
  },
  methods: {
    async getList () {
      const res = await axios({
        url: '/list',
        method: 'get'

      })
      this.list = res.data
    },
    renderfn () {
      this.getList()
    }
  }
}
</script>

<style>

</style>
